<%@ Page Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="WorkItem.aspx.cs" Inherits="Project_WorkItem" Title="Work Item" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ObjectDataSource ID="odsWorkItems" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="FetchByID" TypeName="OpenProject.DataObjects.WorkItemController" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="WorkItemId" Type="Object" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="WorkItemId" Type="Int32" />
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="ItemCategoryId" Type="Int32" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="StatusId" Type="Int32" />
            <asp:Parameter Name="ProjectId" Type="Int32" />
            <asp:Parameter Name="TimeEstimate" Type="Int16" />
            <asp:Parameter Name="TimeActual" Type="Int16" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="CreatedOn" Type="DateTime" />
            <asp:Parameter Name="ImportanceId" Type="Int32" />
            <asp:Parameter Name="CreatedBy" Type="Int32" />
            <asp:Parameter Name="AssignedTo" Type="Int32" />
            <asp:Parameter Name="CompletedBy" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="WorkItemId" QueryStringField="WorkItemId" Type="Object" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="ParentId" Type="Int32" />
            <asp:Parameter Name="ItemCategoryId" Type="Int32" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="StatusId" Type="Int32" />
            <asp:Parameter Name="ProjectId" Type="Int32" />
            <asp:Parameter Name="TimeEstimate" Type="Int16" />
            <asp:Parameter Name="TimeActual" Type="Int16" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="CreatedOn" Type="DateTime" />
            <asp:Parameter Name="ImportanceId" Type="Int32" />
            <asp:Parameter Name="CreatedBy" Type="Int32" />
            <asp:Parameter Name="AssignedTo" Type="Int32" />
            <asp:Parameter Name="CompletedBy" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <asp:DetailsView ID="DetailsView1" CssSelectorClass="CssDetailsView" runat="server" AutoGenerateRows="False" DataSourceID="odsWorkItems"
        Height="50px" Width="125px" GridLines="None">
        <Fields>
            <asp:TemplateField HeaderText="Work item number" SortExpression="WorkItemId">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("WorkItemId") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("WorkItemId") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Literal ID="Literal2" runat="server" Text='<%# Bind("WorkItemId") %>'></asp:Literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Title" SortExpression="Title">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Literal ID="Literal3" runat="server" Text='<%# Bind("Title") %>'></asp:Literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Item category" SortExpression="ItemCategoryId">
                <EditItemTemplate>
                    <subsonic:DropDown TableName="ItemCategory" ValueField='<%# Bind("ItemCategoryId") %>' DataValueField="ItemCategoryId" DataTextField="Title" runat="server" ID="ddlItemCategories"></subsonic:DropDown>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ItemCategoryId") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal4" runat="server" Text='<%# Eval("ItemCategory.Title") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Importance" SortExpression="ImportanceId">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ImportanceId") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("ImportanceId") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal5" runat="server" Text='<%# Eval("Importance.Title") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Status" SortExpression="StatusId">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("StatusId") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("StatusId") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal6" runat="server" Text='<%# Eval("Status.Title") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Created by" SortExpression="CreatedBy">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal7" runat="server" Text='<%# Eval("UserMembership.UserName") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Created On" SortExpression="CreatedOn">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("CreatedOn") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("CreatedOn") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%# Eval("CreatedOn", "{0:D}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Time estimate" SortExpression="TimeEstimate">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("TimeEstimate") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("TimeEstimate") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%# Bind("TimeEstimate") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Actual time taken" SortExpression="TimeActual">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("TimeActual") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("TimeActual") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server" Text='<%# Bind("TimeActual") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Assigned to" SortExpression="AssignedTo">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("AssignedTo") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("AssignedTo") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal11" runat="server" Text='<%# Eval("UserMembershipToAssignedTo.UserName") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="ParentId" SortExpression="ParentId">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("ParentId") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("ParentId") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server" Text='<%# Bind("ParentId") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Completed by" SortExpression="CompletedBy">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox12" runat="server" Text='<%# Bind("CompletedBy") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("CompletedBy") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:literal ID="Literal13" runat="server" Text='<%# Eval("UserMembershipToCompletedBy.UserName") %>'></asp:literal>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Description" SortExpression="Description">
                <EditItemTemplate>
                    <fck:FCKeditor id="txtContent" BasePath="~/FCKeditor/" ToolbarSet="OpenProject" runat="server" Value='<%# Bind("Description") %>'  Height="500" Width="700"/>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField SortExpression="ProjectId">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" CssClass="display-none" runat="server" Text='<%# Bind("ProjectId") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox14" runat="server" Text='<%# Bind("ProjectId") %>'></asp:TextBox>
                </InsertItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="Update"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="Cancel"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="Edit"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>
</asp:Content>

